
import cv2
from human_detect import FaceDetect, EyeDetect

FILENAME = './timg.jpg'

face_detect = FaceDetect()


pic_pig = cv2.imread('pig.jpg')
pig_height = len(pic_pig)
pig_width = len(pic_pig[0])

img = cv2.imread(FILENAME)
gyro = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = face_detect.detect(gyro)

window_height = len(img)
window_width = len(img[0])

for (x, y, w, h) in faces:
    img = cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
    pig = cv2.resize(pic_pig, (w, h))
    img[y:y+h, x:x+w , :] = pig[:, :, :]


cv2.namedWindow('win')
cv2.imshow('win', img)
cv2.waitKey()
